package jsonobj;

import guiobj.SubmitPanelInfo;
import utils.Utils;

import com.google.gson.Gson;

public class JobInfo implements JSonObj {
	public String jobname;
	public String filename;
	public String cputime;
	public String cmd;
	public String cluster_host;
	public long job_id;
	public int nodes;
	public int procs;
	public boolean isMPI;
	public boolean isSire;
	public boolean isTar;
	public int nmoves;
	public int repeat;
	
	public JobInfo() {}
	
	
	public JobInfo(String jn, String f,  String cm, String cput, int n, int p, boolean ismpi, boolean iss)
	{
		this.jobname = jn;
		this.filename = f;
		this.cputime = cput;
		this.cmd = cm;
		this.job_id = Utils.jobcount++;
		this.nodes = n;
		this.procs = p;
		this.isMPI = ismpi;
		this.isSire = iss;
	}
	
	public String toString()
	{
		return CLI_JOB_SUB+"|"+ new Gson().toJson(this);
	}
	
	public static JobInfo fromJSon(String json)
	{
		return new Gson().fromJson(json,JobInfo.class);
	}

}
